# 
# To change this template, choose Tools | Templates
# and open the template in the editor.
 
class Payment
  
  def name
    puts "Welcome to the Monthly Payment Calculator, lets get started."
    puts "Enter the necessary information as it is asked of you."
    puts "Enter your name:"
    @nme = gets
  end
  
  def paymentdata
    puts "Enter the amount of the loan (principal):"
    @princ = gets
    puts "Enter the interest rate:"
    @rt = gets
    puts "Enter the length of the loan in months:"
    @tm = gets
  end
  
  def calculatepayment
     @preinterest = @princ.to_f / @tm.to_f
     @withinterest = @preinterest * (@rt.to_f / 100)
     @amount = @withinterest + @preinterest
  end
  
  def results
    puts "#{@nme} your montly payment on #{@princ} dollars with an interest rate of #{@rt} percent for #{@tm} months is:" 
    puts "$#{@amount}"
  end

end


MyPayment = Payment.new
MyPayment.name
MyPayment.paymentdata
MyPayment.calculatepayment
MyPayment.results




